<?php /* @var $this Controller */ ?>
<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <title><?php echo CHtml::encode($this->pageTitle); ?></title>
        <?php

        Yii::app()->getComponent('bootstrap')->register();
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/js/jquery-barcode.min.js');
        Yii::app()->getClientScript()->registerCssFile(Yii::app()->baseUrl . '/css/custom.logged.css');
        Yii::app()->getClientScript()->registerCssFile(Yii::app()->baseUrl . '/css/style.css');

        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.bootstrap-duallistbox.js');
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/js/jquery.signaturepad.js');
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->baseUrl . '/js/json2.min.js');
        Yii::app()->getClientScript()->registerCssFile(Yii::app()->baseUrl . '/css/bootstrap-duallistbox.css');
        ?>
    </head>

    <body>
        <div id="page-wrap" class="container">
            <header class="navbar navbar-inverse navbar-fixed-top">
                <div class="navbar-inner">
                    <div class="container">
                            <?php
                        $pagename = Yii::app()->controller->id;
                        $user = Yii::app()->user;
                        $this->widget('bootstrap.widgets.TbNavbar', array(
                                'type'=>'inverse', // null or 'inverse'
                                'brand'=>Yii::app()->name,
                                'brandUrl'=>($user->checkAccess(Constant::ROLE_ADMIN) ? $this->createUrl('task/index') : $this->createUrl('public/home')),
                                'collapse'=>true, // requires bootstrap-responsive.css
                                'items'=>array(
                                    array(
                                        'class'=>'bootstrap.widgets.TbMenu',
                                        'encodeLabel'=>false,
                                        'items'=>array(
                                            array('label'=>Yii::t('app', 'Task'), 'url'=>Yii::app()->createUrl('user/taskuser'), 'visible'=>!$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>($pagename=='user' ? true : false)),

                                            array('label'=>Yii::t('app', 'Client'), 'url'=>Yii::app()->createUrl('client/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>(in_array($pagename, array('client','contact')) ? true : false), 'items'=>array(
                                                array('label'=>Yii::t('app', 'Manager client'), 'url'=>Yii::app()->createUrl('client/index')),
                                                array('label'=>Yii::t('app', 'Manager contact'), 'url'=>Yii::app()->createUrl('contact/index')),
                                            )),
                                            array('label'=>Yii::t('app', 'Transporter'), 'url'=>Yii::app()->createUrl('transporter/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>(in_array($pagename, array('comtrans','transporter')) ? true : false), 'items'=>array(
                                                //array('label'=>Yii::t('app', 'Manager company transport'), 'url'=>Yii::app()->createUrl('comtrans/index')),
                                                array('label'=>Yii::t('app', 'Manager transporter'), 'url'=>Yii::app()->createUrl('transporter/index')),
                                            )),
                                            
                                            array('label'=>Yii::t('app', 'Matter'), 'url'=>Yii::app()->createUrl('matter/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>(in_array($pagename, array('matter','analysis','attribute')) ? true : false), 'items'=>array(
                                                array('label'=>Yii::t('app', 'Manager Matter'), 'url'=>Yii::app()->createUrl('matter/index')),
                                                array('label'=>Yii::t('app', 'Step Analysis'), 'url'=>Yii::app()->createUrl('analysis/index')),
                                                '---',
                                                array('label'=>Yii::t('app', 'Attribute Matter'), 'url'=>Yii::app()->createUrl('attribute/index')),
                                            )),
//                                            array('label'=>Yii::t('app', 'User'), 'url'=>Yii::app()->createUrl('user/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>($pagename=='user' ? true : false)),
                                            array('label'=>Yii::t('app', 'Task'), 'url'=>Yii::app()->createUrl('task/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>($pagename=='task' ? true : false)),
                                            array('label'=>Yii::t('app', 'Tracking'), 'url'=>Yii::app()->createUrl('tracking/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>($pagename=='tracking' ? true : false)),
                                            array('label'=>Yii::t('app', 'System'), 'url'=>Yii::app()->createUrl('system/index'), 'visible'=>$user->checkAccess(Constant::ROLE_ADMIN), 'active'=>($pagename=='system' ? true : false)),
                                        ),
                                    ),
//                                    '<form class="navbar-search pull-left" action=""><input type="text" class="search-query span2" placeholder="Search"></form>',
                                    array(
                                        'class'=>'application.components.Langbox',
                                    ),
                                    array(
                                        'class'=>'bootstrap.widgets.TbMenu',
                                        'htmlOptions'=>array('class'=>'pull-right'),
                                        'encodeLabel'=>false,
                                        'items'=>array(
                                            array(
                                                'label'=>Yii::t('app', 'Hi'). ' ' .Yii::app()->user->getState('username'), 
                                                'url'=>Yii::app()->createUrl('/'),
                                                
                                                'items'=>array(
//                                                    array('label'=>'<i class="icon-lock"></i> '.Yii::t('app', 'Change information'), 'url'=>Yii::app()->createUrl('user/info')),
                                                    '---',
                                                    array('label'=>'<i class="icon-off"></i> '.Yii::t('app', 'Logout'), 'url'=>Yii::app()->createUrl('public/logout')),
                                                )
                                            ),
                                        ),
                                    ),
                                ),
                            )); ?>
                        <?php //$this->widget('application.components.Langbox'); ?>
                    </div>
                </div>

            </header>

            <div class="container">
                    <div class="span12">
                        <div id="main-content">
                            <section class="well">
                                <h2 class="page-title"><?php echo $this->pageTitle?></h2>
                            </section>

                            <?php echo $content; ?>
                        </div>
                    </div>
                </div>
            </div><!-- main container-->
        </div>

        <footer>
                <p class="credit">
                    <?php echo  CHtml::image(Yii::app()->getBaseUrl().'/images/sprite.png', ''); ?>
                </p>
        </footer>
        <script type="text/javascript">
            $(document).ready(function() {
                jQuery.noConflict();

            });
        </script>
    </body>
</html>
